/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package adrec;

import java.io.FileNotFoundException;
import java.io.IOException;

/**
 *
 * @author k3j
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws FileNotFoundException, IOException {
//        //args[0]="";
        //AdaptorRecognition.readfilesimple("test/test2", "ATCTCGTATG",0.3, 5, 1, 1);
        if (args.length<2){
            System.out.println("\njava -jar adrec file adapter");
            System.out.println("\nexample:java -jar adrec.jar test/test.fastq ATCTCGTATGCCGTCTTCTGCTTG 1 8 0.3");
            System.out.println("example: see output at adrec/test/seq.ad & adrec/test/seq.noad");
            System.out.println("\n");
            System.exit(1);
        }
        //check input file
        boolean f=tools.checkinput(args[0]);
        //check directory
        String ad=args[1];

        //check species
        int mm=1;
        if (Integer.parseInt(args[2])>=3){
           System.out.println("Only allowed 0-3 mismatch");
            System.exit(1);
        }else{
            mm=Integer.parseInt(args[2]);
        }
        int len=8;
        if (Integer.parseInt(args[3])<5){
           System.out.println("Adapter length should be > 5 nts");
           System.exit(1);
        }else{
            len=Integer.parseInt(args[3]);
        }
        double com=0.3;
        if (Double.parseDouble(args[4])<0.3){
           System.out.println("Complexity should be > 0.3");
           System.exit(1);
        }else{
            com=Double.parseDouble(args[4]);
        }
        if ( f  ){
        //if(true){
            System.out.println("Go to adapter recognition...");
            System.out.println("Mismatches: "+args[2]);
            System.out.println("Length to be recognized: "+args[3]);
            System.out.println("Complexity threshold: "+args[4]);
            System.out.println("Adapter: "+args[1]);
//            go to adapter
//            String pathout, String ad,String ad5,int fasta,String header,int skip, Double com,int lenad, int mmad,int mincount
            AdaptorRecognition.readfilesimple(args[0], ad, com, len, mm, 1);
//           
        }
    }

}
